package com.masterclient.app.widget;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * 作者：sean
 * 创建时间：2017/6/16 16:41
 * 功能说明：
 */

public class SearchItemDecoration extends RecyclerView.ItemDecoration{

    int offset;
    public SearchItemDecoration(int offset) {
        this.offset = offset;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = parent.getChildAdapterPosition(view);

        if(position%2 == 0){
            outRect.set(offset,offset,0,0);
        }else {
            outRect.set(offset,offset,offset,0);
        }

    }
}
